using System.Text.Json;
using Terraria.ModLoader;

namespace RSCore;

public abstract class ModBase : Mod
{
	public override void Load()
	{
		using (File.Open())
		{
			foreach (var path in LoadPath())
			{
				using var stream = OpenRead(path);
			}
		}
	}

	public override void Unload()
	{
	}

	protected virtual List<string> LoadPath()
	{
		using var stream = OpenRead("paths.json");
		return JsonSerializer.Deserialize<string[]>(stream)?.ToList() ?? throw new Exception("Very Bad Json");
	}

	protected virtual Stream OpenRead(string path)
	{
		return File.GetStream(path);
	}
}